package com.bqy.myokgo.fragment.pager;

import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.Button;

import com.bqy.myokgo.R;
import com.bqy.myokgo.base.MyBaseFragment;
import com.bqy.myokgo.utils.NoDoubleClickListener;
import com.bqy.myokgo.utils.SimpleFragmentAdapter;
import com.bqy.myokgo.utils.ToastUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 熊猫先生
 * 2019/1/29:11:57
 */

public class FragmentTwo extends MyBaseFragment {

    FragmentOne fragmentOne;
    FragmentTwo fragmentTwo;
    FragmentThree fragmentThree;
    List<Fragment> fragmentList = new ArrayList<>();
    SimpleFragmentAdapter adapter;
    ViewPager viewPager;

    @Override
    protected int setContentView() {
        return R.layout.fragment_two;
    }

    @Override
    public void iniView() {
        fragmentList.add(fragmentOne = new FragmentOne());
        fragmentList.add(fragmentTwo = new FragmentTwo());
        fragmentList.add(fragmentThree = new FragmentThree());
        adapter = new SimpleFragmentAdapter(getFragmentManager(),fragmentList);

        viewPager = findViewById(R.id.vp_two);
        Button asdasd = findViewById(R.id.asdasd);
        asdasd.setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                viewPager.setAdapter(adapter);

            }
        });

    }

    @Override
    public void iniData() {
        ToastUtils.show("执行了FragmentTwo");
    }
}
